package com.smxy.mall.dao;

import com.smxy.mall.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface UserDao extends JpaRepository<User, Object>, JpaSpecificationExecutor<User> {

    Page<User> findAll(Pageable pageable); //全部用户分页

    Page<User> findByType(String type, Pageable pageable);  //根据用户type分页

    User findByUserNameAndUserPsw(String userName, String userPsw); //用户名密码登录

    User findByPhoneAndUserPsw(String phone, String userPsw); //手机号密码登录

    User findByPhone(String phone);  //手机号是否存在

    User findByOpenId(String openId); //openId是否存在

    User findByUserName(String userName); //用户名是否存在

    User findById(Integer id); //根据用户id查询
}
